package com.xiaoluo.web;

import com.xiaoluo.web.form.SysUserForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.mvc.condition.RequestConditionHolder;
import org.springframework.web.servlet.support.RequestContext;

import javax.servlet.http.HttpSession;

/**
 * Project : XL-CD
 * Package : com.xiaoluo.web
 * Created by Willian.
 * Date  : 2016/1/26 16:43.
 */
public class BaseController {

    @Autowired
    private HttpSession session;

    public SysUserForm getCurrentUser(){

        Object obj = session.getAttribute("SESSION_USER_OBJ");
        if(obj != null){
            return (SysUserForm)obj;
        }

        return null;

    }
    public void setCurrentUser(SysUserForm user){
        session.setAttribute("SESSION_USER",true);
        session.setAttribute("SESSION_USER_OBJ", user);
    }
}
